package com.edu.processer;
/*
 * @Author:princess
 * @Date 2023/10/30 10 30 21:11
 *
 */


import com.edu.interceptor.LogInterceptor;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.cglib.proxy.Enhancer;

import java.lang.reflect.Proxy;

public class LogProcesser_CGlib implements BeanPostProcessor {
    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        System.out.println("进行了强化");
        Object o = Enhancer.create(bean.getClass(), new LogInterceptor(bean));
        return o;
    }
}
